package cxp.MainApp;

import cxp.utils.GeneratoeUtil;

import java.util.Scanner;

/**
 * 生成 spring boot 项目!
 *
 */
public class App {

    private static String packageName;
    private static String projectName;

    public static void main( String[] args ) {

        //确定 项目名称以及包名
        System.out.println("请在需要创建项目的目录执行！");
        System.out.println("=========开始=========");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入项目名称：");
        projectName = sc.nextLine();
        String check1 = GeneratoeUtil.checkCharacter(projectName);
        if(!GeneratoeUtil.OK.equalsIgnoreCase(check1)){
            System.out.println("项目名称 "+check1);
            return;
        }
        System.out.println("请输入包名(2级)：");
        packageName = sc.nextLine();
        String check2 = GeneratoeUtil.checkPackageCharacter(packageName);
        if(!GeneratoeUtil.OK.equalsIgnoreCase(check2)){
            System.out.println("Java包名称 "+check2);
            return;
        }
        //生成文件
        GeneratoeUtil.step1(projectName,packageName);
        GeneratoeUtil.step2(projectName,packageName);
        GeneratoeUtil.step3(projectName,packageName);
        //完成
        System.out.println("=========完成=========");
    }
}
